//引入封装好的接口
import { getBannerList } from "../../../request/api";

const state = {
  bannerlist: [],
};

const getters = {
  getBannerList(state) {
    return state.bannerlist;
  },
};

const mutations = {
  REQ_LIST(state, payload) {
    state.bannerlist = payload;
  },
};

const actions = {
  //列表行动
  getBannerListAction({ commit }) {
    getBannerList()
      .then(res => {
        if (res.code == 200) {
          commit('REQ_LIST', res.list)
        }
      })
  }
};

export default {
  state,
  getters,
  actions,
  mutations,
  namespaced: true,
};